package hsl.haxe.bond;
import hsl.haxe.argument.ListenerArgument;
import hsl.haxe.Subject;

class MonadicBond<Datatype, ArgumentType> implements Bond<Datatype> {
	private var argument:ListenerArgument<ArgumentType, Datatype>;
	private var listener:ArgumentType -> Dynamic;
	public function new(listener:ArgumentType -> Dynamic, argument:ListenerArgument<ArgumentType, Datatype>):Void {
		this.listener = listener;
		this.argument = argument;
	}
	public function callListener(data:Datatype, currentTarget:Subject):Void {
		listener(argument.getValue(data, currentTarget));
	}
}
